<?php

require 'models/ZipcodeCity.php';

class ZipcodeCityController extends BaseController {
    
    public function index() {
        
        $orm = Model::factory('ZipcodeCity');
        $zips = $orm->find_many();
        foreach($zips as $index => $zip) {            
            $zips[$index] = $zip->as_array();
        }
        
        return $zips;
    }
    
    public function view($id) {
        $model = Model::factory('ZipcodeCity')->find_one($id);
        
        if($model == null) {
            $this->http404();
        }
        
        return $model->as_array();
    }
    
}
